{extend name="public/base"/}
 {block name="content"}
       <section class="content-header">
<h1>
           内容编辑
<small>Optional description</small>
</h1>
<ol class="breadcrumb">
	<li><a href="{:U('Index/index')}"><i class="fa fa-dashboard"></i>首页</a></li>
	<li class="active"> 内容编辑</li>
</ol>
</section>
<form action="{:U('Content/editContent', ['id'=>$edit_info['id']])}" method="post">
	<input type="hidden" name="id" value="{$edit_info.id}">
	<input type="hidden" name="cover_img" id="imgs" value="">
	<input type="hidden" name="status" value="0">
	<input type="hidden" name="rec_ok" value="0">
	<input type="hidden" name="top_ok" value="0">
	<section class="content">
	<div class="row">
		<div class="col-md-12">
			<div class="box">
			
				<!--输入框 -->
				<div class="box-body pad" style="padding:10px 20px;">
                    所属栏目：
                    <select name="term_id" id="term_id" class="form-control">
                        <option value="0">不修改栏目</option>
                        {volist name="all_term" id="data"}
                        <option value="{$data.id}" {if condition="($data['id'] eq $edit_info['term_id'])"}selected{/if}>{$data.name}</option>
                        {/volist}
                    </select>
				</div>

				<div class="box-body pad" style="padding:10px 20px;">
                    标题：
					<input class="form-control" name="title" value="{$edit_info.name}" placeholder="标题">
				</div>
                <?php if($termModel['type']==0){ ?>
				<div class="box-body pad" style="padding:10px 20px;">
				关键词：
					<input class="form-control" name="keywords" value="{$edit_info.keywords}" placeholder="关键词">
				</div>
                <?php }; ?>
				<div class="box-body pad" style="padding:10px 20px 0px 20px;">
				摘要：
					<textarea class="form-control" id="des" rows="4" name="description" placeholder="摘要描述(150字以内)">{$edit_info.description}</textarea>
				</div>
				<!--输入框 END-->
				
				<!-- editor -->
				<div class="box-body pad">
					<textarea id="editor" class="ueditor textarea" name="content" placeholder=""
					style="width: 100%;height:300px;font-size: 14px; line-height: 18px;padding: 10px;">{$edit_info.content}</textarea>
                <script> $(function(){ UE.getEditor("editor"); });</script>
				</div>
				<!-- editor end -->
				
				
                <?php if($termModel['type']==0){ ?>
				
				<div style="padding:8px 0px 0px 21px;">
					<input type="checkbox" class="dese" {if condition="($edit_info.intercept eq 1)"}checked="checked"{/if} value="1" name="intercept"> 是否截取内容 
					<input type="text" size="3"  value="150" style="vertical-align: middle;line-height: 20px;"  class="fontsize">字符至内容摘要 
				</div>
				<!-- 于此相关的class id 等勿动 -->
				<script>
					$(document).ready(function(){
					  $(".dese").click(function(){
					    
								if($('.dese').is(':checked')) {
								var TEST = UE.getEditor('editor').getContentTxt();
								var SIZE = $(".fontsize").val();
								$("#des").val(TEST.substr(0,SIZE));
								}else{
								$("#des").val('');
								}
						
					    });
						
					});
				</script>
				<!-- 勿动 -->
				
	            	<!-- 推荐 显示 置顶-->
		<div class="box-body pad" style="padding:10px 20px;">
		发表时间：
			<input class="form-control" name="create_time" value="{$edit_info.create_time|date='Y-m-d H:i:s',###}" placeholder="发表时间">
		</div> 

		<!-- {$edit_info.create_time|date='Y-m-d H:i:s',###}  {:date("Y-m-d H:i:s",time())}-->
				<div style="padding:10px 20px;">
					<input type="checkbox" name="status" {if condition="$edit_info.status eq 1"}checked="checked"{/if} value="1"> 前台显示 &nbsp;&nbsp;
					<input type="checkbox" name="rec_ok" {if condition="$edit_info.rec_ok eq 1"}checked="checked"{/if} value="1"> 推荐 &nbsp;&nbsp;
					<input type="checkbox" name="top_ok" {if condition="$edit_info.top_ok eq 1"}checked="checked"{/if} value="1"> 置顶
				</div>			
					<!-- 推荐 显示 置顶 END-->
				
                <div id="uploader" class="wu-example-one" name="cover_img">
                            <!--用来存放文件信息-->
                            <div id="thelist2" class="uploader-list">
                                <?php if(!empty($edit_info['cover_img'])){ ?>
                                <div class="item">
                                    <input type="hidden" name="cover_img" value="{$edit_info.cover_img}" />
                                    <image style="max-width:300px;max-height:200px" src="__UPLOADS__{$edit_info.cover_img}" />
                                    <a class="remove-img"><i class="fa fa-remove"></i>删除图片</a>
                                </div>
                                <?php }; ?>
                            </div>
                            <div class="btns" style="padding:10px 20px;">
                                <div class="picker" id="picker2">图片上传</div>
                            </div>
                </div>
                <?php }else{ ?>
				<div style="padding:10px 20px;">
					<input type="checkbox" name="status" {if condition="$edit_info.status eq 1"}checked="checked"{/if} value="1"> 通过审核 &nbsp;&nbsp;
				</div>			
                <?php }; ?>

			</div>
			
			<div class="box">
            {foreach $formList as $name => $form}
				<div class="box-body pad" style="padding:10px 20px;">
                    {$name}：
                                {$form}
				</div>
            {/foreach}
			</div>
            
                <?php if($termModel['type']==0){ ?>
			                                 <!-- SEO -->
					<div class="box-header with-border" style="margin:0 18px;padding-left:0;">
						<h3 class="box-title" >SEO设置:</h3>
					</div>
						<div class="highlight">
				    	<dl>
				    		<dt class="adt">
				    			<em class="required"></em>标题:</dt>
				    		<dd class="ftype_input">
				    			<div class="fbox">
				    			   <input class="form-control" name="seo_title" value="{$edit_info.seo_title}" placeholder="META Title（标题）">
				    				
				    			</div>
				    		</dd>
				    	</dl>
				    </div>
					
					<div class="highlight">
				    	<dl>
				    		<dt class="adt">
				    			<em class="required"></em>关键词:</dt>
				    		<dd class="ftype_input">
				    			<div class="fbox">
				    			  <input class="form-control" name="seo_keywords" value="{$edit_info.seo_keywords}" placeholder="META Keywords（关键词）">
				    			</div>
				    		</dd>
				    	</dl>
				    </div>
							
							<div class="highlight">
				    	<dl>
				    		<dt class="adt">
				    			<em class="required"></em>摘要:</dt>
				    		<dd class="ftype_input">
				    			<div class="fbox">
				    			<textarea class="form-control" rows="14" name="seo_description" style="width:100%;height:130px;" placeholder="摘要描述">{$edit_info.seo_description}</textarea>
				    			</div>
				    		</dd>
				    	</dl>
				    </div>
					<!-- SEO END-->
                <?php }; ?>
		</div>
		
	</div>


	</section>
	<div style="padding:10px 20px;"><input type="submit" class="btn btn-block btn-primary" style="width:100px; border:none;" value="提交"/></div>
	<div style="clear:both">
	</div>
	<!-- 姑且如此 -->
	<script language="javascript" type="text/javascript">
								$(document).ready(function(){
									 <!-- 二级栏目-->
									 $("#parent_one").change(function(){
									 var checkValueTwo=$("#parent_one").val();
									 var checkValueTwo_model=$("#parent_one :selected").data('model');
	                                 $("#term_id").val(checkValueTwo);
	                                 $("#model_id").val(checkValueTwo_model);
									  	$.ajax({  
											  type:"post",  
											  url:"{:U('Content/ajaxSelectTwo')}",  
											  dataType:'json',
											  data:{ 
												  Two:checkValueTwo, 
												},  
												success:
												  function(data){
												  
												  if(data != ""){
													$("#ajaxlistTwo").html('');
												    str ='<select class="form-control" id="parent_two" style="float:left;margin-right:10px;"><option value="">选择栏目</option>';
													for(var i=0;i<data.length;i++){
													str +='<option value="'+data[i].id+'">'+data[i].name+'</option>';
													 }
													str = str+'</select>';
													$("#ajaxlistTwo").html(str);
													
													//再调用
			<!-- 三级栏目-->
			 $("#parent_two").change(function(){
			 var checkValueThree=$("#parent_two").val();
			  $("#term_id").val(checkValueThree);
					$.ajax({  
					  type:"post",  
					  url:"{:U('Content/ajaxSelectThree')}",  
					  dataType:'json',
					  data:{ 
						  Three:checkValueThree, 
						},  
						success:
						  function(data){
						  
						  if(data != ""){
							$("#ajaxlistThree").html('');
							str ='<select class="form-control" id="parent_three" style="float:left;margin-right:10px;"><option value="">选择栏目</option>';
							for(var i=0;i<data.length;i++){
							str +='<option value="'+data[i].id+'">'+data[i].name+'</option>';
							 }
							str = str+'</select>';
							$("#ajaxlistThree").html(str);
							//再调用
																	<!-- 四级栏目-->
																	 $("#parent_three").change(function(){
																	 var checkValueFour=$("#parent_three").val();
																	  $("#term_id").val(checkValueFour);
																			$.ajax({  
																			  type:"post",  
																			  url:"{:U('Content/ajaxSelectFour')}",  
																			  dataType:'json',
																			  data:{ 
																				  Four:checkValueFour, 
																				},  
																				success:
																				  function(data){
																				  
																				  if(data != ""){
																					$("#ajaxlistFour").html('');
																					str ='<select class="form-control" id="parent_Four" style="float:left;margin-right:10px;"><option value="">选择栏目</option>';
																					for(var i=0;i<data.length;i++){
																					str +='<option value="'+data[i].id+'">'+data[i].name+'</option>';
																					 }
																					str = str+'</select>';
																					$("#ajaxlistFour").html(str);
																					//再调用
                                                                    $("#parent_Four").change(function(){
																	 var checkValuefive=$("#parent_Four").val();
																	  $("#term_id").val(checkValuefive);
														
																	 })
																					//再调用 END
																					
																					}else{
																					$("#ajaxlistFour").html('');
																					}
																					
																					},
																				 });
																	 })
																	<!-- 四级栏目 END--> 
							//再调用 END
							
							}else{
							$("#ajaxlistThree").html('');
							}
							
							},
						 });
			 })
			<!-- 三级栏目 END--> 
													  //再调用 END
													
													}else{
													$("#ajaxlistTwo").html('');
													}
													
													},
												 });
									 })
									<!-- 二级栏目 END-->  	
								});
							</script> 
</form>
 {/block}
